package com.yosaa.back.enums;

public enum FemaleSitUpScore {
    EXCELLENT_100(100, 56, 57),
    EXCELLENT_95(95, 54, 55),
    EXCELLENT_90(90, 52, 53),
    GOOD_85(85, 49, 50),
    GOOD_80(80, 46, 47),
    PASS_78(78, 44, 45),
    PASS_76(76, 42, 43),
    PASS_74(74, 40, 41),
    PASS_72(72, 38, 39),
    PASS_70(70, 36, 37),
    PASS_68(68, 34, 35),
    PASS_66(66, 32, 33),
    PASS_64(64, 30, 31),
    PASS_62(62, 28, 29),
    PASS_60(60, 26, 27),
    FAIL_50(50, 24, 25),
    FAIL_40(40, 22, 23),
    FAIL_30(30, 20, 21),
    FAIL_20(20, 18, 19),
    FAIL_10(10, 16, 17);

    private final float score;
    private final float freshmanSophomore; // 大一大二标准
    private final float juniorSenior; // 大三大四标准

    FemaleSitUpScore(float score, float freshmanSophomore, float juniorSenior) {
        this.score = score;
        this.freshmanSophomore = freshmanSophomore;
        this.juniorSenior = juniorSenior;
    }

    public float getScore() {
        return score;
    }

    public float getFreshmanSophomore() {
        return freshmanSophomore;
    }

    public float getJuniorSenior() {
        return juniorSenior;
    }

    // 根据成绩和年级计算分数
    public static float calculateScore(float count, String grade) {
        for (FemaleSitUpScore standard : FemaleSitUpScore.values()) {
            float threshold = grade.equals("大一") || grade.equals("大二")
                    ? standard.getFreshmanSophomore()
                    : standard.getJuniorSenior();
            if (count >= threshold) {
                return standard.getScore();
            }
        }
        return 0; // 默认分数
    }
}